function err = svm(X, Y, C, kernel)
%train and test using SVM and output error
    
    [wx, lx] = size(X);
    [wy, ly] = size(Y);
    Xtrain = X(1:wx/2,:);
    Xtest = X(wx/2+1:wx,:);
    Ytrain = Y(1:wy/2,:);
    Ytest = Y(wy/2+1:wy,:);
    %separate data into test and train

    [nsv alpha bias] = svc(Xtrain, Ytrain, kernel, C);%call the svc function
    err = svcerror(Xtrain,Ytrain, Xtest, Ytest, kernel, alpha, bias);%compute error
